/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cvut.fel.taskpro.business.isupport;

import cz.cvut.fel.taskpro.business.support.BusinessRuleException;
import cz.cvut.fel.taskpro.data.entity.Assignment;
import cz.cvut.fel.taskpro.data.entity.AssignmentSubmit;
import cz.cvut.fel.taskpro.data.entity.GroupTaskPro;
import cz.cvut.fel.taskpro.data.entity.Student;
import cz.cvut.fel.taskpro.data.entity.Subject;
import cz.cvut.fel.taskpro.data.entity.SystemEnviroment;
import cz.cvut.fel.taskpro.data.entity.TaskProUser;
import cz.cvut.fel.taskpro.data.entity.Team;
import cz.cvut.fel.taskpro.data.entity.Template;
import cz.cvut.fel.taskpro.data.entity.Version;
import cz.cvut.fel.taskpro.data.entity.VersionFile;
import java.util.List;
import javax.ejb.Local;

/**
 * This interface is responsible for business validate operation.
 *
 * @author Tom
 * @serial 1.0.0 beta
 */
@Local
public interface IBusinessRuleValidator {

    /**
     * This method validate user. The method have to validate lenght of e-mail
     * and username. Method also check if user is null. In incompatible state
     * the BusinessRuleException is invoke, otherwise not.
     *
     * @param taskProUser user who will check for condidition.
     */
    public void validate(TaskProUser taskProUser) throws BusinessRuleException;

    /**
     * This method validate user when is adding. The username and email must be
     * unique. To validate null or min lenght of username and password use
     * validate in this interface. In incompatible state the
     * BusinessRuleException is invoke, otherwise not.
     *
     * @param taskProUser user who will check for create condidition.
     */
    public void validateAdding(TaskProUser taskProUser) throws BusinessRuleException;

    /**
     * This method valiate AssignmentSubmit when is sended. The assignemnt can
     * not be in close or accepted state, deadline can not be expired In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param assignmentSubmit assignment which will check for condidition.
     */
    public void validateSubmitTask(AssignmentSubmit assignmentSubmit) throws BusinessRuleException;

    /**
     * This method validate version of assignmentSubmit. The version have to has
     * at least one file and assignmentSubmit which belongs to. Version also
     * cant be null. In incompatible state the BusinessRuleException is invoke,
     * otherwise not.
     *
     * @param version version which will check for condidition.
     */
    public void validate(Version version) throws BusinessRuleException;

    /**
     * This method validate list of subjects, subjects could not be null or
     * empty In incompatible state the BusinessRuleException is invoke,
     * otherwise not.
     *
     * @param subjects subejcts which will check for condidition.
     */
    public void validate(List<Subject> subjects) throws BusinessRuleException;

    /**
     * This method validate one subject. The subject cant be null In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param subject subejct which will check for condidition.
     */
    public void validate(Subject subject) throws BusinessRuleException;

    /**
     * This method validate group. Group could not be null. In incompatible
     * state the BusinessRuleException is invoke, otherwise not.
     *
     * @param group group which will check for condidition.
     */
    public void validate(GroupTaskPro group) throws BusinessRuleException;

    /**
     * This method validate list of students, which cant be null or empty. In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param mStudents assignment which will check for condidition.
     */
    public void validateStudents(List<Student> mStudents) throws BusinessRuleException;

    /**
     * This method validate list of group, which cant be null or empty. In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param group group which will check for create condidition.
     */
    public void validateGroups(List<GroupTaskPro> group) throws BusinessRuleException;

    /**
     * This method validate new team if is added.The team have to unique name in
     * group. Only one user can be in one team in subject. The method
     * validateTeam(Team newTeam) provide it. So use it. In incompatible state
     * the BusinessRuleException is invoke, otherwise not.
     *
     * @param newTeam team which will check for create condidition.
     */
    public void validateAddTeam(Team newTeam) throws BusinessRuleException;

    /**
     * This method validate rate of assingmentSubmit. The earned score must be
     * equal or greater than 0, the grade or evaluation have to be modified, and
     * state of rated assignemnt could not be submitted after rate. In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param assignmentSubmit assignment which will check for rate condidition.
     */
    public void validateRate(AssignmentSubmit assignmentSubmit) throws BusinessRuleException;

    /**
     * This method valdiate adding of new group. Group could not be null, group
     * code must be unique in subject, subject must be specify, starttime must
     * be greater than stop time, kantor must be specify and group must have at
     * least one student which cant be in other group in the same subject. In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param groupToAdd group which will check for create condidition.
     */
    public void validateAdding(GroupTaskPro groupToAdd) throws BusinessRuleException;

    /**
     * This method validate assignment, which cant be null, max earned score
     * must be greater than 0,deadline must be greater than dateOfStart and
     * dateOfStart must be greater than now time. The template and subject must
     * be specify and target teams, group or students must be specify. In
     * incompatible state the BusinessRuleException is invoke, otherwise not.
     *
     * @param assignment assignment which will check for create condidition.
     */
    public void validate(Assignment assignment) throws BusinessRuleException;

    /**
     * This method validate removing of assignmet. The assignmet to remove cant
     * have any assignmentSubmit and cant be null and empty In incompatible
     * state the BusinessRuleException is invoke, otherwise not.
     *
     * @param assignmentsToRemove assignment which will check for remove condidition.
     */
    public void validateRemove(List<Assignment> assignmentsToRemove) throws BusinessRuleException;

    /**
     * This method validate removing of assignmet. The assignmet to remove cant
     * have any assignmentSubmit and cant be null state the
     * BusinessRuleException is invoke, otherwise not.
     *
     * @param assignmentsToRemove assignment which will check for create condidition.
     */
    public void validateRemove(Assignment assignmentsToRemove) throws BusinessRuleException;

    /**
     * This method validate template. The template must have specify name. If
     * files are added then description is no need, otherwise the description
     * must be specify In incompatible state the BusinessRuleException is
     * invoke, otherwise not.
     *
     * @param template template which will check for condidition.
     */
    public void validate(Template template) throws BusinessRuleException;

    /**
     * This method validate adding list of user. So use particular method which
     * validate one user. In incompatible state the BusinessRuleException is
     * invoke, otherwise not.
     *
     * @param users users which will check for create condidition.
     */
    public void validateAdding(List<TaskProUser> users) throws BusinessRuleException;

    /**
     * This method validate list of subjects, subjects could not be null or
     * empty In incompatible state the BusinessRuleException is invoke,
     * otherwise not.
     *
     * @param newSubject subject which will check for create condidition.
     */
    public void validateAding(Subject newSubject) throws BusinessRuleException;

    /**
     * This method validate removing of assignmet. The assignmet to remove cant
     * have any assignmentSubmit and cant be null and empty In incompatible
     * state the BusinessRuleException is invoke, otherwise not.
     *
     * @param user user which will check for update condidition.
     */
    public void validateModification(TaskProUser user) throws BusinessRuleException;

    /**
     * This method validate adding envriment setting. The list cant be empty or
     * null. Then all enviromnet must be validate by part. In incompatible state
     * the BusinessRuleException is invoke, otherwise not.
     *
     * @param enviroments enviroment which will check for create condidition.
     */
    public void validateAddingEnvriroment(List<SystemEnviroment> enviroments) throws BusinessRuleException;

    /**
     * This method validate adding envriment setting. The enviroment cant be
     * null. KeyOfSettings and value must by specify. KeyOfSettings must be
     * unique. In incompatible state the BusinessRuleException is invoke,
     * otherwise not.
     *
     * @param enviroment enviroment which will check for create condidition. 
     */
    public void validateAddingEnvriroment(SystemEnviroment enviroment) throws BusinessRuleException;

    /**
     * This method validate adding envriment setting. The enviroment cant be
     * null. KeyOfSettings and value must by specify. KeyOfSettings must be
     * unique. In incompatible state the BusinessRuleException is invoke,
     * otherwise not.
     *
     * @param enviroments enviroments which will check for update condidition. 
     */
    public void validateModification(List<SystemEnviroment> enviroments) throws BusinessRuleException;

    /**
     * This method validate a team. Team must have at least one student, Group
     * and each student can be only one team in one subject. In incompatible
     * state the BusinessRuleException is invoke, otherwise not.
     *
     * @param newTeam team which will check for create condidition. 
     */
    public void validateTeam(Team newTeam) throws BusinessRuleException;

    /**
     * This method validate team while is being removed.Team cant have no
     * assignment submit. In incompatible state the BusinessRuleException is
     * invoke, otherwise not.
     *
     * @param teamToRemove team which will check for remove condidition. 
     */
    public void validateRemove(Team teamToRemove) throws BusinessRuleException;

    /**
     * This method check if is possible to remove student from team.
     *
     * @param studentsToRemove students which will be removed from team.
     * @param teamWithStudents team in which students were.
     */
    public void validateRemove(Team teamWithStudents, List<Student> studentsToRemove) throws BusinessRuleException;

    /**
     * This method validate remove group operation. The group to remove cant be
     * null and cant have no submited assingments. In incompatible state the
     * BusinessRuleException is invoke, otherwise not.
     *
     * @param groupToDelete groupTaskPro which will check for remove condidition. 
     */
    public void validateRemove(GroupTaskPro groupToDelete) throws BusinessRuleException;

    /**
     * This method validate remove group operation. The group to remove cant be
     * null and cant have no submited assingments. In incompatible state the
     * BusinessRuleException is invoke, otherwise not.
     *
     * @param oldGroup origin group
     * @param studentsToRemove students who will be removed from origin group
     * @param updatedGroup new group, which will replace origin group
     */
    public void validateModification(GroupTaskPro oldGroup, GroupTaskPro updatedGroup, List<Student> studentsToRemove) throws BusinessRuleException;
/**
     * This method validate version. Version cant be null.
     * In incompatible state the BusinessRuleException is invoke, otherwise not.
     * @param version version which will check for update condidition. 
     */
    public void validateUpdate(VersionFile version) throws BusinessRuleException;
/**
     * This method validate version. Version cant be null.
     * In incompatible state the BusinessRuleException is invoke, otherwise not.
     * @param templateToUpdate  template which will check for update condidition. 
     */
    public void validateUpdate(Template templateToUpdate) throws BusinessRuleException;
/**
     * This method validate template when it can be removed. Template cant 
     * have assignment.
     * In incompatible state the BusinessRuleException is invoke, otherwise not.
     * @param templateToremove  template which will check for remove condidition. 
     */
    public void validateRemove(Template templateToremove) throws BusinessRuleException;
}
